﻿@inherits BaseComponent

@if (!string.IsNullOrWhiteSpace(Title))
{
    <Tooltip TitleTemplate="TitleTemplate(Title)">
        @RenderBadgeButton()
    </Tooltip>
}
else
{
    @RenderBadgeButton()
}

@code {
    private RenderFragment RenderButton => @<Button Class="@Class" Icon="@Icon" Type="@Type" Style="@Style"
                                                    Block="Block" Danger="Danger" Disabled="!Enabled" Loading="isLoad"
                                                    OnClick="OnButtonClickAsync">@Language[Name]</Button>;

    private RenderFragment RenderBadgeButton()
    {
        if (Badge <= 0)
            return RenderButton;

        return @<Badge Count="Badge">@RenderButton</Badge>;
    }
}